package org.example.springoauth2.resourceserver2.controller;

import org.example.springoauth2.securitycommon.config.Inner;
import org.example.springoauth2.securitycommon.entity.SysUser;
import org.example.springoauth2.securitycommon.util.SecurityUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hzq
 * @date 2021/9/13 13:58
 */
@RestController
public class BaseController {

    @GetMapping("/user/info")
    public SysUser userInfo() {
        return SecurityUtils.getSysUser();
    }

    @GetMapping("/server/info")
    public String serverInfo() {
        return "resource-server1";
    }

    @GetMapping(value = {"/ignored", "/getIgnored"})
    @Inner(false)
    public String getIgnored() {
        return "resource-server1 getIgnored";
    }

    @PostMapping(value = {"/ignored", "/postIgnored"})
    @Inner(false)
    public String postIgnored() {
        return "resource-server1 postIgnored";
    }

    @GetMapping("/ig/ignored4/ignored4")
    public String ignored4() {
        return "/ig/ignored4/ignored4";
    }
}
